﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;


namespace WebVideo.Models
{
    public class VideoModel
    {
        public int Id {set ; get; }
        public string Video { set; get; }
        public string Name { set; get; }
        public int? Viewed { set; get; }
        public string Bussiness { set; get; }
        public static VideoModel LayModel(int IdVideo)
        {
            VideoModel Vi = new VideoModel();
            dbVideoDataContext db = new dbVideoDataContext();
            EntityVideo tnew = db.EntityVideos.Where(p => p.Id == IdVideo).Single();
            Vi.Id = tnew.Id;
            Vi.Video = tnew.Video;
            Vi.Name = tnew.Name;
            Vi.Viewed = tnew.Viewed;
            Vi.Bussiness = tnew.EntityBusiness.CompanyName;
            return Vi;

        }
    }
}